/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-06-09 09:49:40
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-06-20 08:59:37
 * @FilePath: \linePatrol\vue-element-plus-admin\src\store\modules\plangroup.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineStore } from 'pinia'
import { store } from '../index'
import EmergencyApi from '@/api/Emergency'
import { EventAssignList, EventSolveList, PlanEventTrack } from '@/api/Emergency/type'

export const useEmergencyStore = defineStore('emergency', {
  state: () => {
    return {
      EventAssignList: [] as unknown as EventAssignList[],
      EventSolveList: [] as unknown as EventSolveList[],
      EventTrackList: [] as unknown as PlanEventTrack[]
    }
  },
  getters: {
    getEventAssign(): EventAssignList[] {
      return this.EventAssignList
    },
    getEventSolve(): EventSolveList[] {
      return this.EventSolveList
    },
    getEventTrack(): PlanEventTrack[] {
      return this.EventTrackList
    }
  },
  actions: {
    async setEventAssign(eventUuid: string | undefined) {
      this.EventAssignList = await EmergencyApi.GetEventAssignList({ eventUuid: eventUuid }) //获取指派 所有列表
    },
    async setEventSolve(eventUuid: string | undefined) {
      this.EventSolveList = await EmergencyApi.GetEventSolveList({ eventUuid: eventUuid }) //获取处置 所有列表
    },
    async setEventTrack(eventUuid: string | undefined) {
      this.EventTrackList = await EmergencyApi.GetEventTrackList({ eventUuid: eventUuid }) //获取跟踪所有列表
    }
  },
  persist: true
})

export const useLockStoreWithOut = () => {
  return useEmergencyStore(store)
}
